﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Aliphant.Common;
using Aliphant.Mvvm.XEvent.UI;

namespace Aliphant.UI.AIChat.Models.Stock
{
    public class OneMinuteData : BindableBase
    {
        public OneMinuteData(string data)
        {
            try
            {
                string[] datas = data.Split(',');
                Start = double.Parse(datas[1]);
                End = double.Parse(datas[2]);
                Max = double.Parse(datas[3]);
                Min = double.Parse(datas[4]);
                Turnover = double.Parse(datas[5]);
                OKPrice = double.Parse(datas[6]);

                Amplitude = double.Parse(datas[7]);
                Chg = double.Parse(datas[8]);
                RiseAmount = double.Parse(datas[9]);
                TurnoverRate = double.Parse(datas[10]);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }

        /// <summary>
        /// 开盘
        /// </summary>
        private double _start;
        public double Start { get => _start; set => SetProperty(ref _start, value); }

        /// <summary>
        /// 收盘
        /// </summary>
        private double _end;
        public double End { get => _end; set => SetProperty(ref _end, value); }

        /// <summary>
        /// 最高
        /// </summary>
        private double _max;
        public double Max { get => _max; set => SetProperty(ref _max, value); }

        /// <summary>
        /// 最低
        /// </summary>
        private double _min;
        public double Min { get => _min; set => SetProperty(ref _min, value); }

        /// <summary>
        /// 成交量
        /// </summary>
        private double _turnover;
        public double Turnover { get => _turnover; set => SetProperty(ref _turnover, value); }

        /// <summary>
        /// 成交额
        /// </summary>
        private double _okPrice;
        public double OKPrice { get => _okPrice; set => SetProperty(ref _okPrice, value); }

        /// <summary>
        /// 振幅
        /// </summary>
        private double _amplitude;
        public double Amplitude { get => _amplitude; set => SetProperty(ref _amplitude, value); }

        /// <summary>
        /// 涨跌幅
        /// </summary>
        private double _chg;
        public double Chg { get => _chg; set => SetProperty(ref _chg, value); }

        /// <summary>
        /// 涨跌额
        /// </summary>
        private double _riseAmount;
        public double RiseAmount { get => _riseAmount; set => SetProperty(ref _riseAmount, value); }

        /// <summary>
        /// 换手率
        /// </summary>
        private double _turnoverRate;
        public double TurnoverRate { get => _turnoverRate; set => SetProperty(ref _turnoverRate, value); }
    }
}
